#include <stack>
#include <vector>

class CQueue {
  public:
    CQueue() {}

    void appendTail(int value) { in.push(value); }

    int deleteHead() {
        if (out.empty()) {
            while (not in.empty()) {
                out.push(in.top());
                in.pop();
            }
        }
        if (out.empty()) return -1;
        auto tmp = out.top();
        out.pop();
        return tmp;
    }

  private:
    std::stack<int> in;
    std::stack<int> out;
};

/**
 * Your CQueue object will be instantiated and called as such:
 * CQueue* obj = new CQueue();
 * obj->appendTail(value);
 * int param_2 = obj->deleteHead();
 */
